package com.tianhui.consignortwofei.mvp.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.tianhui.consignortwofei.R;
import com.tianhui.consignortwofei.mvp.model.FuJianListBean;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

/**
 * @author fgs
 * @date 2020/4/1
 * @description
 **/
public class FuJianListAdapter extends RecyclerArrayAdapter<FuJianListBean.RecordsDTO> {


    private Context mContext ;
    private int lookType;


    public FuJianListAdapter(Context context, int lookType) {//, IOrderStatus iOrderStatus
        super(context);
        mContext=context;
        this.lookType=lookType;
//        this.iOrderStatus = iOrderStatus;
    }



    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        FuJianViewHolder viewHolder = new FuJianViewHolder(parent, R.layout.item_fujian_list);
        return viewHolder;

    }






    public class FuJianViewHolder extends BaseViewHolder<FuJianListBean.RecordsDTO> {
//        private TextView numberTextView;
//        private ImageView bigTvImage;
        private TextView tv_bianhao;
        private TextView tv_cunhuo;
        private TextView tv_kehu;

        private TextView tv_time;
        private TextView tv_remark_text;
        private TextView tv_wei_text;
        private TextView tv_beizhu;
        private TextView tv_zankai;
        private ImageView iv_zankai_icon;

        private TextView tv_xiugai;
        private TextView tv_shanchu;

        private ImageView iv_image;

//        private RecyclerView rv_option_body;




        public FuJianViewHolder(ViewGroup parent, int res) {
            super(parent, res);
//            numberTextView = getView(R.id.item_order_list_numberTextView);
//            bigTvImage = (ImageView) getView(R.id.big_tv_image);
            tv_bianhao = (TextView) getView(R.id.tv_bianhao);
            tv_cunhuo = (TextView) getView(R.id.tv_cunhuo);
            tv_kehu = (TextView) getView(R.id.tv_kehu);

            tv_time = (TextView) getView(R.id.tv_time);
            tv_remark_text = (TextView) getView(R.id.tv_remark_text);
            tv_wei_text = (TextView) getView(R.id.tv_wei_text);



            addOnClickListener(R.id.tv_remark_text);
//            addOnClickListener(R.id.tv_xiugai);
//            addOnClickListener(R.id.tv_shanchu);
//            bigTvTime = (TextView) getView(R.id.big_tv_time);
//            bigTvCommentNum = (TextView) getView(R.id.big_tv_comment_num);
//            bigIvComment = (ImageView) getView(R.id.big_iv_comment);
//            bigTvLikeNum = (TextView) getView(R.id.big_tv_like_num);
//            bigIvLike = (ImageView) getView(R.id.big_iv_like);

        }

        @Override
        public void setData(FuJianListBean.RecordsDTO data) {
            super.setData(data);

            tv_bianhao.setText("编号："+data.getCode());
            tv_cunhuo.setText("存货："+data.getInventorycode());
            tv_kehu.setText("客户："+data.getPartnername());
            tv_time.setText("订单时间："+data.getVoucherdate());

            if ("0".equals(data.getReason())){
                tv_remark_text.setText("点击添加原因");
            }else {
                tv_remark_text.setText(data.getReason());
            }





//            GlideEngine.createGlideEngine().loadImage(mContext,Config.baseImageUrl+data.getImgpicture(),iv_image);

////            List<SubjectTalkListBean.SubjectTalkRecords.SubjectTalkDetails> details = data.getDetails();
//
//            rv_option_body.setFocusable(false);
//            if (null!=data.getPlasticsQuotationList()&&data.getPlasticsQuotationList().size()>0) {
//                rv_option_body.setVisibility(View.VISIBLE);
////            MyLinearLayoutManager linearLayoutManager = new MyLinearLayoutManager(getContext());
//                MyLinearLayoutManager linearLayoutManager = new MyLinearLayoutManager(getContext(),
//                        LinearLayoutManager.VERTICAL, false) {
//                    @Override
//                    public boolean canScrollVertically() {
//                        return false;
//                    }
//                };
////            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//                rv_option_body.setLayoutManager(linearLayoutManager);
//                QuotationSecindItemAdapter homeListAdapter = new QuotationSecindItemAdapter(getContext());
//                rv_option_body.setAdapter(homeListAdapter);
////            homeListAdapter.clear();
//                homeListAdapter.addAll(data.getPlasticsQuotationList());
////                homeListAdapter.setOnItemClickListener(new OnItemClickListener() {
////
////                    @Override
////                    public void onItemClick(int position) {
////
//////                        SubjectTalkListBean.SubjectTalkRecords subjectTalkRecords = newsListAdapter.getAllData().get(position);
////                        if (data == null) {
////                            return;
////                        }
////                        Intent intent=new Intent(mContext, HuatiDetailActivity.class);
////                        intent.putExtra("beanId",data.getId());
////                        mContext.startActivity(intent);
////                    }
////                });
//
//            }
////            else {
////                rv_option_body.setVisibility(View.GONE);
////            }




        }
    }




}
